<style>
  #top_link_area .add-title,
  #top_link_area .add-url,
  #top_link_area .delete{float:left;_display:inline;margin-left:5px;}
  #top_link_area .delete{height:20px;width:16px;cursor:pointer;}
  #top_link_area .top-link-item{background-color:#E2E8EB;padding:5px 5px 3px;line-height:22px;margin:2px 0;}
  #add_top_link{cursor:pointer;}
</style>
<div class="tableform">
<div class="widgetconfig">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
  <tbody>
    <tr>
        <th><{t app='b2c'}>楼层图片：<{/t}></th>
        <td>
            <input type=hidden name="floor_pic" value="<{$setting.floor_pic}>">
            <input name='floor_pic' class="imgsrc" id="floor_pic" value="<{$setting.floor_pic}>">
            <input type=button value="<{t app='b2c'}>上传图片<{/t}>" class="uploadbtn" onclick="addPic()">
        </td>
    </tr>
    <tr>
        <th><{t app='b2c'}>楼层图片链接：<{/t}></th>
        <td>
            <input type="text" name="floor_pic_link" value="<{$setting.floor_pic_link}>" />
        </td>
    </tr>
    <tr>
        <th><{t app='b2c'}>楼层标题背景色：<{/t}></th>
        <td>
            <{input type="color" name="bg_color" value=$setting.bg_color|default:'#cccccc' size=7 maxlength=7}>
        </td>
    </tr>
    <tr>
        <th><{t app='b2c'}>楼层悬浮商品：<{/t}></th>
        <td>
           <{input type="goods_select" object="goods@b2c" filter=$goodslink_filter multiple="true" return_url="{$related_return_url}" rowselect="true"  textcol="name" name="floor_suspended_goods[linkid]" linkid=$setting.floor_suspended_goods.linkid obj_name='floor_suspended_goods[goods]' value=$setting.floor_suspended_goods.goods view="b2c:admin/goods/detail/rel_items.html"}>
        </td>
    </tr>
    <tr>
        <th><{t app='b2c'}>副标题文字链接：<{/t}></th>
        <td>
            <input type="button" id="add_top_link" value="添加文字链接" />
            <ul id="top_link_area">

            </ul>
        </td>
    </tr>
    <tr>
        <th><{t app='b2c'}>楼层商品：<{/t}></th>
        <td>
           <{input type="goods_select" object="goods@b2c" filter=$goodslink_filter multiple="true" return_url="{$related_return_url}" rowselect="true"  textcol="name" name="floor_goods[linkid]" linkid=$setting.floor_goods.linkid obj_name='floor_goods[goods]' value=$setting.floor_goods.goods view="b2c:admin/goods/detail/rel_items.html"}><span>(请选择9个商品)</span>
        </td>
    </tr>
  </tbody>
</table>

</div>
</div>
<script>
    function addPic(){
            var url='index.php?app=desktop&act=alertpages&goto='+encodeURIComponent("index.php?app=image&ctl=admin_manage&act=image_broswer&type=big");
            Ex_Loader('modedialog',function(){
            return new imgDialog(url,{onCallback:function(image_id,image_src){
                     $('floor_pic').value=image_src;
            }});
            });
        }
</script>
<script>
	var TopLinkTitle = new Array(<{foreach from=$setting.top_link_title item=title_item}> "<{$title_item}>", <{/foreach}>"end");
    TopLinkTitle.pop();
    var TopLinkUrl = new Array(<{foreach from=$setting.top_link_url item=url_item}>"<{$url_item}>",<{/foreach}>"end");
    TopLinkUrl.pop();
    var TopLink = new Hash(TopLinkUrl.associate(TopLinkTitle));
    function DelTopLink(item){
        item.getParent(".top-link-item").destroy();
    }
    function CreateTopLinkDom(DomHash){
      DomHash.each(function(v,k){
        var ActiveLi = new Element('li',{'class':'top-link-item clearfix','html':'<div class="add-title"> 文字：<input type="text" name="top_link_title[]" value="'+k+'"/> </div> <div class="add-url"> 链接地址：<input type="text" name="top_link_url[]" value="'+v+'"/> </div> <span class="delete" title="删除"></span>'}).inject('top_link_area');
        ActiveLi.getElement('.delete').addEvent('click',function(){
          DelTopLink(this);
        });
      });
    }
    CreateTopLinkDom(TopLink);
    var AddTopLink = $('add_top_link');
    AddTopLink.addEvent('click',function(){
      var ActiveLi = new Element('li',{'class':'top-link-item clearfix','html':'<div class="add-title"> 文字：<input type="text" name="top_link_title[]"/> </div> <div class="add-url"> 链接地址：<input type="text" name="top_link_url[]"/> </div> <span class="delete" title="删除"></span>'}).inject('top_link_area');
      ActiveLi.getElement('.delete').addEvent('click',function(){
        DelTopLink(this);
      });
    });
</script>